#ifndef Tui_TButton_h
#define Tui_TButton_h

 
#include "TScale9.h"
#include "TBase.h"

using namespace rapidxml;

class TButton:public TPanelItem{
    
public:
    TButton();
    ~TButton();
    
    
    static TButton* create(xml_node<> * pItem);
    virtual  void initWidthConf(xml_node<> * pItem);
    
    CREATE_FUNC(TButton);
    
    virtual void selected(); 
    virtual void unselected();
    virtual void onEnter();

    
    virtual void setVisible(bool visible);
 
    void setTarget(CCObject*   ,SEL_MenuHandler);
    void setEnable(bool value);
    DEV_PROPERTY_READONLY(bool, m_bEnable, Enable)
    
    void setLabel(const char*);
    const char* getLabel();
    string linkPanel;
protected:
    
    const char* m_pLabel;
    
    
    CCObject*       m_pListener;
    SEL_MenuHandler    m_pfnSelector;
    
    CCNodeRGBA* m_pNormal;
    CCNodeRGBA* m_pDown;
    CCNodeRGBA* m_pDisable;
    
    CCSprite* m_pNormalLabel;
    CCSprite* m_pDownLabel;
    CCSprite* m_pDisableLabel;
    
    void clear();
   
};

#endif
